-- 需要绘制操作时的临时canvas

local canvases = {}
function IntToN2(x)
    for i = 1, 13 do
        local ret = 2 ^ i
        if ret >= x then
            return ret
        end
    end
end

function GetTempCanvasN2(width, height)
    local w = IntToN2(width)
    local h = IntToN2(height)
    if not canvases[w] then
        canvases[w] = {}
    end
    if not canvases[w][h] then
        canvases[w][h] = love.graphics.newCanvas(w, h)
    end
    return canvases[w][h]
end